﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace DoNet.Common.Utilities
{
    public class DataCache
    {
        static Hashtable objCache = new Hashtable();

        public static object GetCache(string CacheKey)
        {
            return objCache[CacheKey];
        }

        public static void SetCache(string CacheKey, object objObject)
        {
            if (!objCache.ContainsKey(CacheKey))
                objCache.Add(CacheKey, objObject);
        }

        public static void RemoveCache(string CacheKey)
        {
            if (objCache.ContainsKey(CacheKey))
                objCache.Remove(CacheKey);
        }

        public static void RemoveAllCache()
        {
            foreach (DictionaryEntry de in objCache)
            {
                objCache.Remove(de.Key);
            }

            objCache.Clear();
        }
    }
}
